1) Field of the Invention
The present invention relates to an information processing apparatus which creates and executes a thread, as a minimum piece of processing, in response to a request from an application program.
2) Description of the Related Art
The so-called multithreaded OSs (operating systems) enable execution of more than one thread in a program (process). Since threads in a process can share memory resources and the like, transfer of data between the threads is relatively easy.
FIG. 10 is a diagram illustrating an example of a conventional information processing apparatus using a multithreaded OS. In FIG. 10, the application program 10 is stored, for example, in a storage device, and executed when necessary. When the thread processing unit 20 receives a request for creation of a thread from the application program 10, the thread processing unit 20 handles the request, and executes the thread. The operating system (OS) 30 receives from the thread processing unit 20 the request for creation of a thread, and creates the thread in response to the request.
In the thread processing unit 20, when the application program 10 sends to the thread processing unit 20 a request for creation of a thread, the thread-request processing unit 20a receives the request, and requests the operating system 30 to create the thread. When the creation of the thread succeeds, the thread-request processing unit 20a informs the thread management unit 20b of the success in creation of the thread. When the creation of the thread does not succeed, the thread-request processing unit 20a informs the application program 10 of the unsuccessful creation as an error. In addition, when the creation of the thread succeeds, the thread management unit 20b delegates the executed-thread management unit 20c to manage the newly created thread. The executed-thread management unit 20c manages execution of threads by the thread execution units 20d to 20f. Each of the thread execution units 20d to 20f is created in order to execute a new thread. When the execution of each thread is completed, the corresponding thread execution unit ceases to exist.
The operations of the construction of FIG. 10 are explained below.
When the application program 10 requests the thread processing unit 20 to create a thread, the thread-request processing unit 20a receives the request, and requests the operating system 30 to create the thread. When the creation of the thread succeeds, a new thread execution unit is created, and the management of the newly created thread is delegated to the executed-thread management unit 20c. That is, the thread management unit 20b supplies information on the newly created thread to the executed-thread management unit 20c so that the executed-thread management unit 20c can manage the thread. Then, the executed-thread management unit 20c assigns the execution of the thread to the newly created thread execution unit.
On the other hand, when the creation of the thread does not succeed, the operating system 30 informs the thread-request processing unit 20a of the unsuccessful creation, and then the thread-request processing unit 20a informs the application program 10 of the unsuccessful creation as an error. The application program 10 sends the request again for creating a thread, to the thread-request processing unit 20a, a predetermined time after the application program 10 receives the notification of the error.
However, since the application program 10 cannot recognize an appropriate time at which a new thread can be created, the application program 10 must frequently make the request for creation of a thread. When the request for creation of a thread is frequently made, processing in the entire system is delayed.
In addition, when the creation of the thread does not succeed, the thread-request processing unit 20a must request the operating system 30 again to create a thread. However, it takes a long time for the operating system 30 to process the request for creation of a thread. Therefore, when the number of requests for creating a thread, which are made to the operating system 30, increases, processing delay in the entire system increases.